import request from '@/utils/request'

export const SpecApi = {

  /**
   *  分页
   * @returns
   */
  getPage: (data) => {
    return request({
      url: '/manage/food/spec/getPage',
      data,
      method: 'post'
    })
  },

  /**
   *  删除
   * @returns
   */
  delete: (specId) => {
    return request({
      url: '/manage/food/spec/delete',
      params:{specId},
      method: 'get'
    })
  },

  /**
   *  更新
   * @returns
   */
  update: (data) => {
    return request({
      url: '/manage/food/spec/update',
      data,
      method: 'post'
    })
  },

  /**
   *  修改排序
   * @returns
   */
  updateSort: (data) => {
    return request({
      url: '/manage/food/spec/updateSort',
      data,
      method: 'post'
    })
  },

  /**
   *  插入
   * @returns
   */
  insert: (data) => {
    return request({
      url: '/manage/food/spec/insert',
      data,
      method: 'post'
    })
  },

  /**
   *  获取规格值
   * @returns
   */
  getAllListBySpecId: (specId) => {
    return request({
      url: '/manage/food/spec/getAllListBySpecId',
      params:{specId},
      method: 'get'
    })
  },

  /**
   *  获取商品分类规格
   * @returns
   */
  getSpecByGoodsClassId: (goodsClassId) => {
    return request({
      url: '/manage/food/spec/getSpecByGoodsClassId',
      params:{goodsClassId},
      method: 'get'
    })
  },

  /**
   *  指保存规格值
   * @returns
   */
  saveSpecValue: (data) => {
    return request({
      url: '/manage/food/spec/saveSpecValue',
      data,
      method: 'post'
    })
  },
  /**
   *  添加一个规格值
   * @returns
   */
  addOneSpecValue: (data) => {
    return request({
      url: '/manage/food/spec/addOneSpecValue',
      data,
      method: 'post'
    })
  }
}
